home *** CD-ROM | disk | FTP | other *** search
- On 05-Jan-98, Marcin Juszkiewicz (Szczepan/SubBlaBla) wrote:
- > Hi !
- > Jakis czas temu zaczalem pisac playerka do sampli. W chwili obecnej
- >program nie strzela Enforcerem ale mam teraz inny problem. Poniewaz program
- >ma byc 100% zgodny z systemem to do odtwarzania uzywam audio.device i tu
- >pojawia sie problem - by odtworzyc sampla dluzszego niz 64KB trzeba uzyc
- >double bufferingu. Znalazlem gdzies odpowiednia rutynke i zaadoptowalem ja
- >do wlasnych potrzeb. Calosc jest ponizej. Niestety to nie dziala - moze
- >ktos wie co i potrafi wskazac bledy ??? Zaznaczam, ze wolalbym odpowiedzi
- >jak to zrobic w E ale nie pogardze procedura w C lub Pascalu.
-
- Nie znam E, ale na pierwszy zrzut oka widzac pare bledow:
-
- >DEF au_replyport = NIL : PTR TO mp,
- > au_replyport1 = NIL : PTR TO mp,
- > au_replyport2 = NIL : PTR TO mp,
- > au_audioio = NIL : PTR TO ioaudio,
- > au_audioio1 = NIL : PTR TO ioaudio,
- > au_audioio2 = NIL : PTR TO ioaudio
- > IF (au_replyport := CreateMsgPort()) = NIL THEN Raise(ERR_NO_PORT)
- ^
- To jest zbedne - au_replyport jest tylko pointerem.
-
- > IF (au_replyport1 := CreateMsgPort()) = NIL THEN Raise(ERR_NO_PORT)
- > IF (au_replyport2 := CreateMsgPort()) = NIL THEN Raise(ERR_NO_PORT)
- > IF (au_audioio := New (SIZEOF ioaudio)) = NIL THEN Raise(ERR_NO_MEM)
- ^
- To jest zbedne - audioio jest tylko pointerem.
-
- > IF (au_audioio1 := New (SIZEOF ioaudio)) = NIL THEN Raise(ERR_NO_MEM)
- > IF (au_audioio2 := New (SIZEOF ioaudio)) = NIL THEN Raise(ERR_NO_MEM)
- > au_audioio1::io::mn::ln.pri := 127
- > au_audioio1::io::mn.replyport := au_replyport1
- > au_audioio1.allockey := NIL
- > au_audioio1.data := [1,2,4,8]:CHAR
- > au_audioio1.length := 4
- > IF (au_allocerror := OpenDevice('audio.device',NIL,au_audioio1,NIL)) THEN
- >Raise(ERR_NO_AUDIO)
- >PROC au_PlaySample(wf,sl)
- > DEF position = 0,
- > samplen,
- > nowlen,
- > port
- > samplen := sl
- > position := wf
- > stop()
- > au_audioio1::io.command := CMD_WRITE
- > au_audioio1::io.flags := ADIOF_PERVOL
- > au_audioio1.period := Div(au_clock,frequency)
- > au_audioio1.volume := 64
- > au_audioio1.cycles := 1
- > au_audioio2 := au_audioio1
- ^
- Tutaj ustawiles oba audioio na ten sam pointer. Powinienes skopiowac
- ustawienia audioio1 do audioio2.
-
- > au_audioio1::io::mn.replyport := au_replyport1
- > au_audioio2::io::mn.replyport := au_replyport2
- ^
- I te operacje odbywaja sie na tym samym audioio.
-
- > au_audioio::io::mn.replyport := au_replyport
- ^ Ta linia jest zbedna.
-
- >-> Double buffering
- > au_audioio1.data := wf
- > au_audioio1.length := 64000
- > sl := sl - 64000
- > IF sl > 64000
- > nowlen := 64000
- > ELSE
- > nowlen := sl
- > ENDIF
- > au_audioio2.data := wf + 64000
- > au_audioio2.length := nowlen
- > sl := sl -nowlen
- > beginio(au_audioio1)
- > beginio(au_audioio2)
- > au_replyport := au_replyport1
- > au_audioio := au_audioio1
- > port := 1
- > WHILE sl > 0
- > Wait(au_replyport)
- > GetMsg(au_replyport)
- > IF sl > 64000
- > au_audioio.data := position
- > au_audioio.length := 64000
- > sl := sl - 64000
- > position := position + 64000
- > ELSE
- > au_audioio.data := position
- > au_audioio.length := sl
- > position := position + sl
- > sl := 0
- > ENDIF
- > beginio(au_audioio)
- > SELECT port
- > CASE 1
- > au_audioio := au_audioio2
- > au_replyport := au_replyport2
- > port := 2
- > CASE 2
- > au_audioio := au_audioio1
- > au_replyport := au_replyport1
- > port := 1
- > ENDSELECT
- > ENDWHILE
- >ENDIF
- >ENDPROC
-
- Docent
- --
- You only have a problem when you think you have a problem.
-
-